#include <QtCore/QCoreApplication>
#include <QApplication>
#include <QtCore>
#include <QtSvg/QSvgGenerator>
#include <QFont>
#include <QColor>
#include <QFontDatabase>
#include <QStringList>
#include <QPainter>
#include <QPoint>
#include <QTextItem>
#include <iostream>
#include <QFontDialog>
#include <QColorDialog>

int main(int argc, char *argv[])
{
    std::cout << "Program started..." << std::endl;
    QApplication a(argc, argv);
    //*
    QSvgGenerator generator;
    generator.setFileName("test01.svg");
    generator.setSize(QSize(640, 420));
    generator.setViewBox(QRect(0, 0, 640, 420));
    generator.setTitle("SVG Generator Example Drawing");
    generator.setDescription("An SVG drawing created by the SVG Generator "
                                 "Example provided with Qt.");

    QPainter painter;
    painter.begin(&generator);


    /*
    QFont f("Liberation Serif");
    f.setWeight( QFont::Bold );
    f.setStyle( QFont::StyleItalic );
    f.setPointSize(80);
    painter.setFont(f);
    QPen pen(Qt::red);
    painter.setPen(pen);
    //*/
    bool ok = false;
    QFont font = QFontDialog::getFont(&ok, NULL);
    QColor color = QColorDialog::getColor(Qt::red, NULL);

    painter.setFont(font);
    QPen pen(color);
    painter.setPen(pen);

    painter.drawText(100, 100, "test text");
    painter.drawText(QRectF(0, 300, 640, 420), Qt::AlignHCenter, "centered text");


    painter.end();

    std::cout << "Program terminated!!" << std::endl;

    return a.exec();
}
